var Cat = require("./cat");

var taidi = new Cat("taidi",4);
var zangao = new Cat("zangao",8);

taidi.on("bark", () => {
    console.log(this);
    this.energy = this.energy-1;
    taidi.bark();
})

zangao.on("bark", () => {
    console.log(this);
    this.energy = this.energy-1;
    zangao.bark();
})

setTimeout(() => {
    taidi.emit("bark");
    zangao.emit("bark");
},1000)